if(has("win32") || has("win64") || has("win95") || has("win16"))
   let g:iswindows = 1
else
   let g:iswindows = 0
endif

if has("autocmd")
    au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif

if has("syntax")
    syntax on
endif
set hlsearch        "高亮搜索
set incsearch       "在输入要搜索的文字时，实时匹配
" set noincsearch "在输入要搜索的文字时，取消实时匹配
set mouse=a                    " 在任何模式下启用鼠标
set mouseshape=s:udsizing,m:no
set t_Co=256                   " 在终端启用256色
set backspace=2                " 设置退格键可用
set smarttab "指定按一次backspace就删除shiftwidth宽度的空格
set smartindent                                       "启用智能对齐方式
set ignorecase                                        "搜索模式里忽略大小写
set smartcase "如果搜索模式包含大写字符，不使用 'ignorecase' 选项，只有在输入搜索模式并且打开 'ignorecase' 选项时才会使用
set expandtab                                         "将Tab键转换为空格
set tabstop=4                                         "设置Tab键的宽度
set shiftwidth=4                                      "换行时自动缩进4个空格
set nofoldenable                                        "启用折叠
" set foldmethod=manual                                "marker 折叠方式
" set foldmethod=indent                                "indent 折叠方式
" set foldmethod=marker                                "marker 折叠方式
set number                                            "显示行号
set nocompatible                                      "禁用 Vi 兼容模式
" set nowrap                                            "设置不自动换行


set writebackup "保存文件前建立备份，保存成功后删除该备份
set nobackup                                "设置无备份文件
set noswapfile                              "设置无临时文件
set vb t_vb=                                "关闭提示音

set encoding=utf-8
set fileencodings=ucs-bom,utf-8,gbk,cp936,latin-1     "设置支持打开的文件的编码

set fileformat=unix                                   "设置新文件的<EOL>格式
set fileformats=unix,dos,mac                          "给出文件的<EOL>格式类型
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.rar,.idea,*.png,*.jpg,*.exe,*.dll,*.gif,*.pdf  "设置全局忽略的二进制文件和临时文件

set statusline=%t\ %1*%m%*\ %1*%r%*\ %2*%h%*%w%=%l%3*/%L(%p%%)%*,%c%V]\ [%b:0x%B]\ [%{&ft==''?'TEXT':toupper(&ft)},%{toupper(&ff)},%{toupper(&fenc!=''?&fenc:&enc)}%{&bomb?',BOM':''}%{&eol?'':',NOEOL'}]



filetype off                                           "vundle插件需要filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#begin()

Plugin 'gmarik/vundle'
Plugin 'shawncplus/phpcomplete.vim'
    Plugin 'triglav/vim-visual-increment'
    Plugin 'othree/html5.vim'
    Plugin 'xolox/vim-misc'
    Plugin 'pangloss/vim-javascript'
    Plugin 'hail2u/vim-css3-syntax'

    " haml sass scss支持插件
Plugin 'tpope/vim-haml'
Plugin 'groenewege/vim-less'
Plugin 'godlygeek/tabular'
Plugin 'snowair/vim-gitgutter'
Plugin 'scrooloose/nerdcommenter'
Plugin 'vim-scripts/matchit.zip'
Plugin 'scrooloose/nerdtree'
Plugin 'ivalkeen/nerdtree-execute'
Plugin 'tpope/vim-surround'

Plugin 'Lokaltog/vim-easymotion'
Plugin 'mhinz/vim-startify'
" 质量最好的括号自动完成插件,不会与其他插件有冲突
Plugin 'kana/vim-smartinput'
" 通过+ _号选择内容插件
Plugin 'terryma/vim-expand-region'

Plugin 'tpope/vim-repeat'
Plugin 't9md/vim-choosewin'

call vundle#end()            " required
" ----------------------------------------------------------------------------
" vundle配置结束
"
"  ----------------------------------------------------------------------------
filetype on                                           "启用文件类型侦测
filetype plugin on "针对不同的文件类型加载对应的插件
filetype plugin indent on    " required

map  <silent><s-F1>  <ESC>:call g:NERDTreeCreator.TogglePrimary('')<CR>
imap  <silent><s-F1>  <ESC>:call g:NERDTreeCreator.TogglePrimary('')<CR>
map  <silent><s-F5> <ESC>:Startify<cr>
imap <silent><s-F5> <ESC>:Startify<cr>
nmap  <silent><s-F6> <ESC>:nohl<cr>

map   <S-Insert>  <ESC>"+p
imap  <S-Insert>  <ESC>"+p
map   <c-Insert>  "+y

map  <S-Del> "+x

map <c-k> <ESC><c-w>k
map <c-j> <ESC><c-w>j
map <c-h> <ESC><c-w>h
map <c-l> <ESC><c-w>l
map <d-h> <ESC>gT
map <d-l> <ESC>gt
imap <c-k> <ESC><c-w>k
imap <c-j> <ESC><c-w>j
imap <c-h> <ESC><c-w>h
imap <c-l> <ESC><c-w>l
imap <d-h> <ESC>gT
imap <d-l> <ESC>gt

nmap s <Plug>(easymotion-s)
nmap  -  <Plug>(choosewin)

let NERDSpaceDelims = 1                     "在左注释符之后，右注释符之前留有空格

set nrformats=alpha,octal,hex
let g:gitgutter_enabled = 1
let g:ctrlp_reuse_window = 'startify'
autocmd VimEnter *
                \   if !argc()
                \ |   Startify
                \ |   cd $HOME
                \ |   wincmd w
                \ | endif
autocmd FileType startify setlocal buftype=

autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType python setlocal et sta sw=4 sts=4
